package cn.ac.siom.query.service.impl;

import cn.ac.siom.query.dao.ITabWeblibMapper;
import cn.ac.siom.query.service.ITabWeblibService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/8/14 0014.
 */
@Service
public class TabWeblibServiceImpl implements ITabWeblibService {

    @Resource
    private ITabWeblibMapper tabWeblibMapper;

    @Override
    public Map selectWeblib(Map params) throws Exception {
        if(!params.containsKey("rownum")){
            params.put("rownum",5);
        }
        if(!params.containsKey("page_id")){
            params.put("page_id",1);
        }
        List<Map> list=tabWeblibMapper.selectWeblib(params);
        Integer count=tabWeblibMapper.selectCount(params);
        Map map=new HashMap();
        map.put("data",list);
        map.put("count",count);
        map.put("page_id",params.get("page_id"));
        return map;
    }

    @Override
    public Integer selectCount(Map params) throws Exception {
        return tabWeblibMapper.selectCount(params);
    }
}
